import React, { Component } from 'react';
import { Form, Input, Button } from 'antd';
import CodeEdit from './components/CodeEdit';

@Form.create()
class CodeEditDemo extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }

  render() {
    const {
      form: { getFieldDecorator, validateFields },
    } = this.props;
    return (
      <div>
        <Form>
          <Form.Item>{getFieldDecorator('test1', {})(<Input />)}</Form.Item>
          <Form.Item>{getFieldDecorator('test2', {})(<CodeEdit />)}</Form.Item>
        </Form>
        <Button
          type="primary"
          onClick={() => {
            validateFields((err, data) => {
              if (err) {
                return;
              }
              console.log(data);
            });
          }}
        >
          提交
        </Button>
      </div>
    );
  }
}

export default CodeEditDemo;
